const fs = require('fs');
const path = require('path');

// 读取文件内容
const filePath = path.join(__dirname, 'app/controller/procurement/supplier_controller.js');
const content = fs.readFileSync(filePath, 'utf8');

// 按行分割
const lines = content.split('\n');

// 查找第802行附近的内容
console.log('第800行:', lines[799]);
console.log('第801行:', lines[800]);
console.log('第802行:', lines[801]);
console.log('第803行:', lines[802]);
console.log('第804行:', lines[803]);

// 检查是否有不匹配的括号
let braceCount = 0;
let inTryBlock = false;

for (let i = 0; i < lines.length; i++) {
  const line = lines[i];
  
  // 检查try语句
  if (line.trim().startsWith('try {')) {
    inTryBlock = true;
  }
  
  // 检查catch语句
  if (line.trim().startsWith('} catch')) {
    if (!inTryBlock) {
      console.log('发现不匹配的catch语句在第', i + 1, '行:', line);
    } else {
      inTryBlock = false;
    }
  }
  
  // 检查大括号
  for (let j = 0; j < line.length; j++) {
    if (line[j] === '{') {
      braceCount++;
    } else if (line[j] === '}') {
      braceCount--;
      if (braceCount < 0) {
        console.log('发现不匹配的闭合大括号在第', i + 1, '行:', line);
      }
    }
  }
}

console.log('最终大括号计数:', braceCount);
console.log('是否在try块中:', inTryBlock);